//
//  MPCardDetailViewCell.m
//  MobileProject
//
//  Created by caiqilin on 2017/6/15.
//  Copyright © 2017年 caiqilin. All rights reserved.
//

#import "MPCardDetailViewCell.h"
#import "MPCard.h"
@interface MPCardDetailViewCell()
@property (weak, nonatomic) IBOutlet UILabel *topLabel;
@property (weak, nonatomic) IBOutlet UILabel *bottomLabel;
@property (weak, nonatomic) IBOutlet UIImageView *cardImageView;
@property (weak, nonatomic) IBOutlet UILabel *menuLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *voiceLabel;
@property (weak, nonatomic) IBOutlet UIView *middleView;
@property (weak, nonatomic) IBOutlet UIImageView *redImageView;
@property (weak, nonatomic) IBOutlet UIImageView *orangeImageView;
@property (weak, nonatomic) IBOutlet UIImageView *blackImageView;
@property (weak, nonatomic) IBOutlet UIImageView *grayImageView;
@property (weak, nonatomic) IBOutlet UILabel *redLabel;
@property (weak, nonatomic) IBOutlet UILabel *orangeLabel;
@property (weak, nonatomic) IBOutlet UILabel *blackLabel;
@property (weak, nonatomic) IBOutlet UILabel *grayLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end
@implementation MPCardDetailViewCell
+ (instancetype)cellWithTableView:(UITableView *)tableView {
    static NSString *ID = @"MPCardDetailViewCell";
    MPCardDetailViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        
        cell = [[[NSBundle mainBundle] loadNibNamed:@"MPCardDetailViewCell" owner:nil options:nil] lastObject];
    }
    
    return cell;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.middleView.layer.borderColor = [[UIColor grayColor] CGColor];
    self.topLabel.layer.borderColor = [[UIColor grayColor] CGColor];
    self.bottomLabel.layer.borderColor = [[UIColor grayColor] CGColor];
    
    self.topLabel.textColor = [Util stringTOColor:@"#333333"];
    self.menuLabel.textColor = [Util stringTOColor:@"#333333"];
    self.typeLabel.textColor = [Util stringTOColor:@"#333333"];
    self.bottomLabel.textColor = [Util stringTOColor:@"#333333"];
    
    self.redLabel.textColor = [Util stringTOColor:@"#333333"];
    self.orangeLabel.textColor = [Util stringTOColor:@"#333333"];
    self.blackLabel.textColor = [Util stringTOColor:@"#333333"];
    self.grayLabel.textColor = [Util stringTOColor:@"#333333"];
    
}

- (void)setCard:(MPCard *)card {
    _card = card;
    
    self.topLabel.text = card.title;
    self.bottomLabel.text = [NSString stringWithFormat:@"%@",[card.detailTitle stringByReplacingOccurrencesOfString:@"\\n" withString:@" \r\n" ]];
    self.cardImageView.image = [UIImage imageNamed:card.imageUrl];
    self.menuLabel.text = card.cardName;
    if([card.typeName isEqualToString:@"1"]){
       self.typeLabel.text = @"基本牌";
    }else if([card.typeName isEqualToString:@"5"]){
        self.typeLabel.text = @"宝物牌";
    }else if([card.typeName isEqualToString:@"4"]){
        self.typeLabel.text = @"装备牌";
    }else{
        self.typeLabel.text = @"锦囊牌";
 
    }
    
    
    if(card.caohua.length > 0){
        self.blackLabel.text = card.caohua;
    }else {
        self.blackLabel.text = @"无";
    }
    
    if(card.fangpian.length > 0){
        self.orangeLabel.text = card.fangpian;
    }else {
        self.orangeLabel.text = @"无";
    }
    
    if(card.hongtao.length > 0){
        self.redLabel.text = card.hongtao;
    }else {
        self.redLabel.text = @"无";
    }
    
    if(card.heitao.length > 0){
        self.grayLabel.text = card.heitao;
    }else {
        self.grayLabel.text = @"无";
    }
    
    self.contentLabel.text = [NSString stringWithFormat:@"%@(%@)",card.name,card.number];
    
}

@end
